﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Honestysoft.BaseObject;
using Honestysoft.Baseframework.WebUI;
using System.Data;

namespace Honestysoft.Financing.WebUI.Apply
{
    public partial class UcCompanyCombo : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                
            }
        }

        public void DataBind(DataTable dtSource)
        {
            cc.DataSource = dtSource;
            cc.DataTextField = "CompName";
            cc.DataValueField = "ID";
            cc.DataBind();
        }

        public Unit Width
        {
            get
            {
                return cc.Width;
                //object obj = ViewState["Width"];
                //return obj == null ? 100 : Convert.ToInt32(obj);
            }
            set
            {
                cc.Width = value;
                //ViewState["Width"] = value;
            }
        }

        public string CompanyID
        {
            get
            {
                return cc.SelectedValue;
                //return cc.Items[cc.SelectedIndex].Value;
            }
            set
            {
                cc.SelectedValue = value;
                //cc.Items[cc.SelectedIndex].Value = value;
            }
        }

        public string CompanyName
        {
            get
            {
                return cc.SelectedItem.Text;
                //return cc.Items[cc.SelectedIndex].Text;
            }
            set
            {
                cc.SelectedItem.Text = value;
                //cc.Items[cc.SelectedIndex].Text = value;
            }
        }
    }
}